﻿<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
    protected string Notice = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {

        }
        else
        {
            this.SqlDataSource1.SelectCommand = this.SqlText.Text;
        }
    }
    private string GetSelectedList()
    {
        string s = "";
        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            if (((CheckBox)this.GridView1.Rows[i].FindControl("Check_Item")).Checked)
            {
                if (s == "")
                {
                    this.InID.Text = this.GridView1.DataKeys[i].Values[1].ToString();
                    this.OutID.Text = this.GridView1.DataKeys[i].Values[2].ToString();
                    this.GongHuo2.Text = this.GridView1.DataKeys[i].Values[3].ToString();
                    this.LuHao2.Text = this.GridView1.DataKeys[i].Values[4].ToString();
                    this.ZhongLiang.Text = this.GridView1.DataKeys[i].Values[5].ToString();
                    this.ChangDu.Text = this.GridView1.DataKeys[i].Values[6].ToString();
                    this.ZhiShu.Text = this.GridView1.DataKeys[i].Values[7].ToString();
                    this.KunHao.Text = this.GridView1.DataKeys[i].Values[8].ToString();
                }
                s += "," + this.GridView1.DataKeys[i].Values[0].ToString();
            }
        }
        if (s.Length > 0)
        {
            s = s.Substring(1);
        }
        this.IDList.Text = s;
        return s;
    }
    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        this.GridView1.SelectedIndex = -1;
        this.Edit1.Enabled = false;
        this.Edit2.Enabled = false;
        this.Panel3.Visible = false;
        this.Panel4.Visible = false;
        
        this.TextBox_Pager.Text = (this.GridView1.PageIndex + 1).ToString();
        this.Label_Pages.Text = " 共" + this.GridView1.PageCount.ToString() + "页 ";

        this.Button_Pager_First.CssClass = "pageturn-first-b";
        this.Button_Pager_First.Enabled = true;
        this.Button_Pager_Prev.CssClass = "pageturn-prev-b";
        this.Button_Pager_Prev.Enabled = true;
        this.Button_Pager_Next.CssClass = "pageturn-next-b";
        this.Button_Pager_Next.Enabled = true;
        this.Button_Pager_Last.CssClass = "pageturn-last-b";
        this.Button_Pager_Last.Enabled = true;
        if (this.GridView1.PageIndex == 0)
        {
            this.Button_Pager_Prev.CssClass = "pageturn-prev-g";
            this.Button_Pager_Prev.Enabled = false;
        }
        if (this.GridView1.PageIndex < 2)
        {
            this.Button_Pager_First.CssClass = "pageturn-first-g";
            this.Button_Pager_First.Enabled = false;
        }
        if (this.GridView1.PageIndex == this.GridView1.PageCount - 1 || this.GridView1.PageCount == 0)
        {
            this.Button_Pager_Next.CssClass = "pageturn-next-g";
            this.Button_Pager_Next.Enabled = false;

        }
        if (this.GridView1.PageIndex > this.GridView1.PageCount - 3)
        {
            this.Button_Pager_Last.CssClass = "pageturn-last-g";
            this.Button_Pager_Last.Enabled = false;
        }

    }
    protected void GridView1_PageIndexChanged(object sender, EventArgs e)
    {
        this.GridView1_DataBound(null, null);
    }
    protected void Pager_Click(object sender, EventArgs e)
    {
        if (sender.GetType().ToString() == "System.Web.UI.WebControls.Button")
        {
            switch (((Button)sender).CommandName)
            {
                case "--":
                    this.GridView1.PageIndex = 0;
                    break;
                case "-":
                    if (this.GridView1.PageIndex > 0) this.GridView1.PageIndex--;
                    break;
                case "+":
                    if (this.GridView1.PageIndex < this.GridView1.PageCount - 1) this.GridView1.PageIndex++;
                    break;
                case "++":
                    this.GridView1.PageIndex = this.GridView1.PageCount - 1;
                    break;
            }
        }
        else
        {

            int p;
            if (int.TryParse(TextBox_Pager.Text, out p))
            {
                if (p >= 1 && p <= this.GridView1.PageCount)
                {
                    this.GridView1.PageIndex = p - 1;
                }
            }
            TextBox_Pager.Text = (this.GridView1.PageIndex + 1).ToString();
        }

    }
    protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e)
    {
        Label_Total.Text = "共查询到 " + e.AffectedRows + " 项记录";
    }
    protected void PageSizeOption_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.GridView1.PageSize = int.Parse(this.PageSizeOption.Text);
    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
    }


    private void Set_Button_State()
    {
        string idlist=GetSelectedList();
        if (idlist == "")
        {
            this.Edit1.Enabled = false;
            this.Edit2.Enabled = false;
        }
        else
        {
            this.Edit1.Enabled = true;
            if (idlist.IndexOf(",") < 0)
            {
                this.Edit2.Enabled = true;
            }
            else
            {
                this.Edit2.Enabled = false;
            }
        }
        this.Panel3.Visible = false;
        this.Panel4.Visible = false;
    }
    
    
    protected void Check_All_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox s = (CheckBox)sender;
        string cs = "grid-row-normal";
        if (s.Checked)
        {
            cs = "grid-row-selected";
        }
        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            ((CheckBox)this.GridView1.Rows[i].FindControl("Check_Item")).Checked = s.Checked;
            this.GridView1.Rows[i].CssClass = cs;
        }
        //this.Button_Delete.Enabled = false;
        this.Set_Button_State();
    }
    protected void Check_Item_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox s = (CheckBox)sender;
        string cs = "grid-row-normal";
        if (s.Checked)
        {
            cs = "grid-row-selected";
        }

        ((GridViewRow)s.Parent.Parent).CssClass = cs;
        string list = GetSelectedList();
        if (list != "" && list.IndexOf(',') < 0)
        {
            //this.Button_Delete.Enabled = true;
        }
        else
        {
            //this.Button_Delete.Enabled = false;
        }
        this.Set_Button_State();
    }
    private string GetState()
    {
        string state = "";
        if (this.ChanPin.Text != "0")
        {
            state += " and t1.产品类别ID=" + this.ChanPin.Text;
        }

        if (this.GongHuo.Text != "0")
        {
            state += " and t1.原料供货ID=" + this.GongHuo.Text;
        }

        if (this.FenChang.Text != "0")
        {
            if (this.FenChang.Text == "5")
            {
                state += " and (t1.生产线=501 or t1.生产线=502)";
            }
            else
            {
                state += " and t1.生产线=" + this.FenChang.Text;
            }
        }

        if (this.LuHao.Text != "")
        {
            state += " and t1.炉号='" + this.LuHao.Text.Replace("'", "''") + "'";
        }
        
        DateTime d;
        if (DateTime.TryParse(this.Date1.Text, out d))
        {
            state += " and t1.入库日期>='" + d.ToShortDateString() + "'";
        }
        if (DateTime.TryParse(this.Date2.Text, out d))
        {
            state += " and t1.入库日期<='" + d.ToShortDateString() + "'";
        }

        if (state.StartsWith(" and"))
        {
            state = state.Substring(4);
        }
        if (state != "")
        {
            state = " where " + state;
        }
        return state;
    }
    
    
    protected void Button_Query_Click(object sender, EventArgs e)
    {

        string state = this.GetState();

        this.SqlText.Text =
@"select top 10000 t1.id,t1.入库单ID,t1.出库单ID,t1.产品类别ID,t1.原料供货ID,t1.生产线
,t1.捆号,t1.炉号,t1.重量,t1.长度,t1.支数,t1.入库日期,t1.出库日期,t1.状态,t2.名称 as 供货
,left(right('00000'+cast(t1.捆号 as varchar),9),4)+'-'+right(cast(t1.捆号 as varchar),4) as 捆号S
,t3.序号 as 入库序号,t4.序号 as 出库序号
,case when t1.生产线=101 then '一分厂'
when t1.生产线=201 then '二分厂'
when t1.生产线=501 then '五分厂C1'
when t1.生产线=502 then '五分厂C2'
else '' end as 生产单位
,case when t1.产品类别ID=1 then '油管(J55)'
when t1.产品类别ID=2 then '套管(J55)'
when t1.产品类别ID=3 then '油管(N80)'
when t1.产品类别ID=4 then '套管(N80)'
else '' end as 品名
,case when t1.状态=0 then '待检'
when t1.状态=1 then '合格'
when t1.状态=2 then '已发'
else '' end as 状态描述

from 产品库存 t1
left outer join 原料供货单位 t2 on t2.ID=t1.原料供货ID
left outer join 产品入库单 t3 on t3.ID=t1.入库单ID
left outer join 产品出库单 t4 on t4.ID=t1.出库单ID

" + state +" order by t1.捆号";
        this.SqlDataSource1.SelectCommand = "";
        this.SqlDataSource1.SelectCommand = this.SqlText.Text;

        
    }

    protected void Button_Reset_Click(object sender, EventArgs e)
    {
        this.ChanPin.Text = "0";
        this.FenChang.Text = "0";
        this.GongHuo.Text = "0";
        this.KunHao1.Text = "";
        this.KunHao2.Text = "";
        this.LuHao.Text = "";
        this.Date1.Text = "";
        this.Date2.Text = "";
    }

    protected void GongHuo_DataBound(object sender, EventArgs e)
    {
        this.GongHuo2.DataBind();
        this.GongHuo2.Items.RemoveAt(0);
    }

    protected void Edit1_Click(object sender, EventArgs e)
    {
        this.Panel3.Visible = true;
        this.Panel4.Visible = false;
    }

    protected void Edit2_Click(object sender, EventArgs e)
    {
        this.Panel4.Visible = true;
        this.Panel3.Visible = false;
    }

    protected void Button_Save_Click(object sender, EventArgs e)
    {
        this.SqlDataSource1.UpdateCommand = "update 产品库存 set 原料供货ID=@供货ID,炉号=@炉号 where ID in(" + this.IDList.Text + ")";
        int er = this.SqlDataSource1.Update();
        this.Notice = "成功修改"+er+"条";
        this.Panel3.Visible = false;

    }

    protected void Button_Save2_Click(object sender, EventArgs e)
    {
        this.SqlDataSource1.UpdateCommand = "update 产品库存 set 重量=@重量,长度=@长度,支数=@支数,捆号=@捆号 where ID =" + this.IDList.Text
            + ";declare @总重量 as numeric(9,1),@总长度 as numeric(9,2),@总支数 smallint";
        if (this.InID.Text != "0" && this.InID.Text != "")
        {
            this.SqlDataSource1.UpdateCommand += ";select @总重量=SUM(重量),@总长度=SUM(长度),@总支数=SUM(支数) from 产品库存 where 入库单ID=" + this.InID.Text
                + ";update 产品入库单 set 总重量=@总重量,总长度=@总长度,总支数=@总支数 where ID=" + this.InID.Text;
        }
        if (this.OutID.Text != "0" && this.InID.Text != "")
        {
            this.SqlDataSource1.UpdateCommand += ";select @总重量=SUM(重量),@总长度=SUM(长度),@总支数=SUM(支数) from 产品库存 where 出库单ID=" + this.OutID.Text
                + ";update 产品出库单 set 总重量=@总重量,总长度=@总长度,总支数=@总支数 where ID=" + this.OutID.Text;
        }
        this.SqlDataSource1.Update();
        this.Notice = "成功修改";
        this.Panel4.Visible = false;
    }
</script>
<html>
<head></head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
 ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" OnSelected="SqlDataSource1_Selected">
 <UpdateParameters>
 
 <asp:ControlParameter Name="入库单ID" DbType="Int32" Size="4" ControlID="InID" />
 <asp:ControlParameter Name="出库单ID" DbType="Int32" Size="4" ControlID="OutID" />
 <asp:ControlParameter Name="供货ID" DbType="Int32" Size="4" ControlID="GongHuo2" />
 <asp:ControlParameter Name="炉号" DbType="AnsiString" Size="10" ControlID="LuHao2" />
 <asp:ControlParameter Name="重量" DbType="Decimal" Size="5" ControlID="ZhongLiang" />
 <asp:ControlParameter Name="长度" DbType="Decimal" Size="5" ControlID="ChangDu" />
 <asp:ControlParameter Name="支数" DbType="Byte" Size="1" ControlID="ZhiShu" />
  <asp:ControlParameter Name="捆号" DbType="Int32" Size="4" ControlID="KunHao" />
 </UpdateParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT 0 as [ID], '全部' as [名称] UNION SELECT [ID], [名称] FROM [原料供货单位]"></asp:SqlDataSource>

<asp:Label ID="SqlText" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="IDList" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="InID" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="OutID" runat="server" Text="" Visible="false"></asp:Label>

<div id="wintop" class="wintop">产品管理</div>
<asp:Panel ID="Panel1" runat="server" CssClass="panel" Visible="false">

</asp:Panel>
<asp:Panel ID="Panel2" runat="server" CssClass="panel" >
<asp:SqlDataSource ID="DS_ChanPin" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT [ID],[品名]+' '+[钢级]+' '+[规格] AS 名称 FROM [产品]">
</asp:SqlDataSource>
产品类别：
<asp:DropDownList ID="ChanPin" runat="server" Width="150px" 
                            Font-Size="12px" DataSourceID="DS_ChanPin" 
                            DataTextField="名称" DataValueField="ID">
</asp:DropDownList>
<span style="margin-left:10px;"></span>生产单位：<asp:DropDownList ID="FenChang" runat="server" Width="120px">
    <asp:ListItem Value="0">全部</asp:ListItem>
    <asp:ListItem Value="101">一分厂</asp:ListItem>
    <asp:ListItem Value="201">二分厂</asp:ListItem>
    <asp:ListItem Value="5">五分厂</asp:ListItem>
    <asp:ListItem Value="501">　五分厂C1</asp:ListItem>
    <asp:ListItem Value="502">　五分厂C2</asp:ListItem>
</asp:DropDownList> 

<span style="margin-left:10px;"></span>原料供货：<asp:DropDownList ID="GongHuo" runat="server" 
    DataSourceID="SqlDataSource2" DataTextField="名称" DataValueField="ID" ondatabound="GongHuo_DataBound"
    Width="120px">
</asp:DropDownList>


<div style="font-size:2px;height:2px;line-height:2px;"></div>

起始捆号：<asp:TextBox ID="KunHao1" runat="server" CssClass="intxt1" Width="120px"></asp:TextBox>
<span style="margin-left:10px;"></span>截止捆号：<asp:TextBox ID="KunHao2" runat="server" CssClass="intxt1" Width="120px"></asp:TextBox>

<span style="margin-left:10px;"></span>炉　　号：<asp:TextBox ID="LuHao" runat="server" CssClass="intxt1" Width="120px"></asp:TextBox>

<div style="font-size:1px;height:1px;line-height:1px;"></div>

入库日期：<asp:TextBox ID="Date1" runat="server" CssClass="intxt1" Width="120px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
<span style="margin-left:25px;margin-right:25px;">至</span><asp:TextBox ID="Date2" runat="server" CssClass="intxt1" Width="120px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));" />

<span style="margin-left:10px;"></span><asp:Button ID="Button_Query" runat="server" 
        Text="查 询" CssClass="mbutton" UseSubmitBehavior="False" 
        onclick="Button_Query_Click" />
<asp:Button ID="Button_Reset" runat="server" Text="清空条件" CssClass="mbutton" 
        UseSubmitBehavior="False" onclick="Button_Reset_Click" />
</asp:Panel>

<div class="gridframe">
    <div class="gridview">
    
        <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
            <tr>
	            <td class="grid-title"><div style="float:left;"><div style="float:left;margin-top:3px;">
	                产品信息
	                <asp:Button ID="Edit1" runat="server" 
                        Text="修改原料信息" CssClass="mbutton2" UseSubmitBehavior="False" 
                        onclick="Edit1_Click" />
                    <asp:Button ID="Edit2" runat="server" 
                        Text="修改捆信息" CssClass="mbutton2" UseSubmitBehavior="False" 
                        onclick="Edit2_Click" />
	            </div><div style="float:right;">
                    <asp:DropDownList ID="PageSizeOption" runat="server" AutoPostBack="True" 
                        onselectedindexchanged="PageSizeOption_SelectedIndexChanged">
                    <asp:ListItem Value="10">10 项/页</asp:ListItem>
                    <asp:ListItem Value="20" Selected="True">20 项/页</asp:ListItem>
                    <asp:ListItem Value="30">30 项/页</asp:ListItem>
                    <asp:ListItem Value="50">50 项/页</asp:ListItem>
                    <asp:ListItem Value="100">100 项/页</asp:ListItem>
                    </asp:DropDownList></div></div>
                    
                    <asp:Panel ID="Panel3" runat="server" Visible="false">
                        <div style="float:left;font-weight:normal;margin:5px;margin-left:20px;padding:5px;border:1px solid #ffffff;">
                        原料供货：<asp:DropDownList ID="GongHuo2" runat="server" 
                            DataSourceID="SqlDataSource2" DataTextField="名称" DataValueField="ID" Width="120px">
                        </asp:DropDownList>
                        <span style="margin-left:5px;"></span>炉号：<asp:TextBox ID="LuHao2" runat="server" CssClass="intxt1" Width="120px"></asp:TextBox>
                        <asp:Button ID="Button_Save" runat="server" Text="保 存" CssClass="mbutton" 
                                UseSubmitBehavior="False" onclick="Button_Save_Click" />
                        </div>
                    </asp:Panel>
                    <asp:Panel ID="Panel4" runat="server" Visible="false">
                        <div style="float:left;font-weight:normal;margin:5px;margin-left:20px;padding:5px;border:1px solid #ffffff;">
                        捆号：<asp:TextBox ID="KunHao" runat="server" CssClass="intxt1" Width="80px"></asp:TextBox>
                        重量：<asp:TextBox ID="ZhongLiang" runat="server" CssClass="intxt1" Width="80px"></asp:TextBox>
                        长度：<asp:TextBox ID="ChangDu" runat="server" CssClass="intxt1" Width="80px"></asp:TextBox>
                        支数：<asp:TextBox ID="ZhiShu" runat="server" CssClass="intxt1" Width="60px"></asp:TextBox>
                        <asp:Button ID="Button_Save2" runat="server" Text="保 存" CssClass="mbutton" 
                                UseSubmitBehavior="False" onclick="Button_Save2_Click" />
                        </div>
                    </asp:Panel>
	            </td>
	            
	            
	        </tr>
	        <tr>
	            <td class="grid-back">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID,入库单ID,出库单ID,原料供货ID,炉号,重量,长度,支数,捆号" 
                        DataSourceID="SqlDataSource1"
                        PageSize="20"
                        GridLines="None" ondatabound="GridView1_DataBound" 
                        onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                        UseAccessibleHeader="False" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged" >
                        <PagerSettings Visible="False" />
                        <RowStyle CssClass="grid-row-normal" />
                        <Columns>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:CheckBox ID="Check_All" runat="server" AutoPostBack="true"
                                        oncheckedchanged="Check_All_CheckedChanged" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="Check_Item" runat="server" AutoPostBack="true" 
                                        oncheckedchanged="Check_Item_CheckedChanged"/>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="24px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="捆号" SortExpression="捆号">
                                <ItemTemplate>
                                    <asp:Label ID="Label_kh" runat="server" Text='<%# Eval("捆号S") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="品名" SortExpression="产品类别ID">
                                <ItemTemplate>
                                    <asp:Label ID="Label_pm" runat="server" Text='<%# Eval("品名") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="生产单位" SortExpression="生产线">
                                <ItemTemplate>
                                    <asp:Label ID="Label_scdw" runat="server" Text='<%# Eval("生产单位") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                            
                            
                            <asp:TemplateField HeaderText="原料供货" SortExpression="原料供货ID">
                                <ItemTemplate>
                                    <asp:Label ID="Label_gh" runat="server" Text='<%# Eval("供货") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="90px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="炉号" SortExpression="炉号">
                                <ItemTemplate>
                                    <asp:Label ID="Label_lh" runat="server" Text='<%# Eval("炉号") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="70px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="重量">
                                <ItemTemplate>
                                    <asp:Label ID="Label_kz" runat="server" Text='<%# Eval("重量") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="50px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="长度">
                                <ItemTemplate>
                                    <asp:Label ID="Label_cd" runat="server" Text='<%# Eval("长度") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="50px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="支数">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zs" runat="server" Text='<%# Eval("支数") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="30px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="状态" SortExpression="状态">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zt" runat="server" Text='<%# Eval("状态描述") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="入库">
                                <ItemTemplate>
                                    <asp:Label ID="rk" runat="server" ToolTip='<%# Eval("入库序号") %>' Text='<%# Eval("入库日期","{0:d}") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="出库">
                                <ItemTemplate>
                                    <asp:Label ID="ck" runat="server" ToolTip='<%# Eval("出库序号") %>' Text='<%# Eval("出库日期","{0:d}") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                            

                            
                        </Columns>
                        <SelectedRowStyle CssClass="grid-row-selected" />
                      </asp:GridView>
	            </td>
            </tr>
            <tr>
	            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                    ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                 
                                <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

	            </td>
            </tr>
        </table>
        

    </div>
</div>

</form>

<script type="text/javascript">
var notice = '<%=this.Notice %>';
if (notice != '') {
    parent.showmsgbox(notice);
}
</script>
<script type="text/javascript">
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
        }
        if (rows[i].className == "grid-row-normal"
        || rows[i].className == "grid-row-bright"
        || rows[i].className == "grid-row-selected") {
            rows[i].onclick = selectRow;
        }
    }
 
</script>

</body>
</html>